package cn.liumouren.tool.security.demo.controller;

import cn.liumouren.tool.security.autoconfigure.annotation.RequirePermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试demo
 *
 * @author Daniel Liu
 * @date 2021/3/5 16:51
 */
@RestController
public class DemoController {

    @GetMapping
    public String get() {
        return "/ 成功啦!!";
    }

    @GetMapping("/query")
    @RequirePermissions("user")
    public String user() {
        return "/query 成功啦!!";
    }

    @GetMapping("/update")
    @RequirePermissions({"admin", "user"})
    public String admin() {
        return "/update 成功啦!!";
    }

    @GetMapping("/user/login")
    @RequirePermissions({"user"})
    public String userLogin() {
        return "/userLogin 成功啦!!";
    }

    @GetMapping("/admin/login")
    @RequirePermissions({"admin"})
    public String adminLogin() {
        return "/adminLogin 成功啦!!";
    }

}
